From: Eli Zaretskii Date: Mon, 10 Dec 2012 12:08:02 +0000 (+0200) Subject: Merge from trunk + rename the event. Not tested yet. X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1^2~5^2~3615^2~1395 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=3907e630a71d48e693062b350571990d7ba08bbb;p=emacs.git Merge from trunk + rename the event. Not tested yet. --- 3907e630a71d48e693062b350571990d7ba08bbb diff --cc lisp/subr.el index 1a850b1eabf,4f2e8f22bfe..1e509036cd1 --- a/lisp/subr.el +++ b/lisp/subr.el @@@ -4185,6 -4322,26 +4322,36 @@@ convenience wrapper around `make-progre (progress-reporter-done ,temp2) nil ,@(cdr (cdr spec))))) + + ;;;; Support for watching filesystem events. + + (defun inotify-event-p (event) + "Check if EVENT is an inotify event." + (and (listp event) + (>= (length event) 3) + (eq (car event) 'file-inotify))) + + ;;;###autoload + (defun inotify-handle-event (event) - "Handle file system monitoring event. -If EVENT is a filewatch event then the callback is called. If EVENT is -not a filewatch event then a `filewatch-error' is signaled." ++ "Handle inotify file system monitoring event. ++If EVENT is an inotify filewatch event, call its callback. ++Otherwise, signal a `filewatch-error'." + (interactive "e") + (unless (inotify-event-p event) + (signal 'filewatch-error (cons "Not a valid inotify event" event))) - + (funcall (nth 2 event) (nth 1 event))) + ++(defun w32notify-handle-event (event) ++ "Handle MS-Windows file system monitoring event. ++If EVENT is an MS-Windows filewatch event, call its callback. ++Otherwise, signal a `filewatch-error'." ++ (interactive "e") ++ (if (and (eq (car event) 'file-w32notify) ++ (= (length event) 3)) ++ (funcall (nth 2 event) (nth 1 event)) ++ (signal 'filewatch-error ++ (cons "Not a valid MS-Windows file-notify event" event)))) ++ ;;;; Comparing version strings. diff --cc src/keyboard.c index 98c1cc0b78b,4c484efe0c0..ecf1551622f --- a/src/keyboard.c +++ b/src/keyboard.c @@@ -315,9 -313,6 +313,9 @@@ static Lisp_Object Qfunction_key Lisp_Object Qmouse_click; #ifdef HAVE_NTGUI Lisp_Object Qlanguage_change; +#ifdef WINDOWSNT - Lisp_Object Qfile_notify; ++Lisp_Object Qfile_w32notify; +#endif #endif static Lisp_Object Qdrag_n_drop; static Lisp_Object Qsave_session; @@@ -3925,16 -3906,6 +3909,16 @@@ kbd_buffer_get_event (KBOARD **kbp make_number (event->modifiers))); kbd_fetch_ptr = event + 1; } + else if (event->kind == FILE_NOTIFY_EVENT) + { + /* Make an event (file-notify (DESCRIPTOR ACTION FILE) CALLBACK). */ - obj = Fcons (Qfile_notify, ++ obj = Fcons (Qfile_w32notify, + list2 (list3 (make_number (event->code), + XCAR (event->arg), + XCDR (event->arg)), + event->frame_or_window)); + kbd_fetch_ptr = event + 1; + } #endif else if (event->kind == SAVE_SESSION_EVENT) { @@@ -11376,7 -11348,6 +11361,7 @@@ syms_of_keyboard (void #ifdef HAVE_NTGUI DEFSYM (Qlanguage_change, "language-change"); - DEFSYM (Qfile_notify, "file-notify"); ++ DEFSYM (Qfile_w32notify, "file-w32notify"); #endif #ifdef HAVE_DBUS @@@ -12148,8 -12126,6 +12140,8 @@@ keys_of_keyboard (void #if defined (WINDOWSNT) initial_define_lispy_key (Vspecial_event_map, "language-change", "ignore"); - initial_define_lispy_key (Vspecial_event_map, "file-notify", ++ initial_define_lispy_key (Vspecial_event_map, "file-w32notify", + "w32notify-handle-event"); #endif } diff --cc src/lisp.h index 2148a623cc7,5acb37f08d1..c7a70feced7 --- a/src/lisp.h +++ b/src/lisp.h @@@ -3519,11 -3516,11 +3516,16 @@@ extern void syms_of_fontset (void) extern Lisp_Object Qfont_param; #endif +#ifdef WINDOWSNT +/* Defined on w32notify.c. */ +extern void syms_of_w32notify (void); +#endif + + /* Defined in inotify.c */ + #ifdef HAVE_INOTIFY + extern void syms_of_inotify (void); + #endif + /* Defined in xfaces.c. */ extern Lisp_Object Qdefault, Qtool_bar, Qfringe; extern Lisp_Object Qheader_line, Qscroll_bar, Qcursor;